<?php
class Controller_Admin_Sys extends Controller_Template
{
    public function __construct ($request, $response)
    {
        $this->template = 'smarty:admin/system/index';
        parent::__construct ($request, $response);
    }

    public function action_index ()
    {
    }

    //
    // 删除渠道
    //
    public function action_remove_channel ()
    {
        $this->template->set_filename("smarty:channel/remove");
        $post = $this->request->post();

        if (empty($post))
        {
            return;
        }
        else
        {
            $chn_curr_key = trim(Arr::get($post, 'chn_curr_key'));

            try {

                if (empty($chn_curr_key))
                    throw new Exception("渠道标识不可为空");

                Promotion_Channel_CPA::remove_channel ($chn_curr_key);

                $this->template->set('alert_message', "渠道删除成功！");
            }
            catch(Exception $e)
            {
                $this->template->set('alert_message', $e->getMessage());
            }
        }
    }

    public function action_acl_reload() 
    {
		$acl = Acl_Mgr::reload();
		if ($acl instanceof Acl)
            $this->template->set('alert_message', "刷新系统权限完成");
        else
            $this->template->set('alert_message', "刷新系统权限失败");
    }
}
